﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HL.Core.Models;
using HL.Lib.MVC;

namespace HL.Lib.Models
{
    public class MMapCatalogueModel : DefaultModel
    {
    }

    public class MMapCatalogueEntity : EntityBase
    {
        [DataInfo]
        public int CatalogueId { get; set; }

        [DataInfo]
        public String  CatalogueName { get; set; }

        [DataInfo]
        public int DeleteFlg { get; set; }
    }

    public class  MMapCatalogueService:ServiceBase<MMapCatalogueEntity>
    {

        public MMapCatalogueService()
            : base("[Map_Catalogue]")
        {

        }

        private static MMapCatalogueService _Instance = null;
        public static MMapCatalogueService Instance
        {
            get
            {
                if (_Instance == null)
                    _Instance = new MMapCatalogueService();

                return _Instance;
            }
        }

        public List<MMapCatalogueEntity> GetCatalogue()
        {
            return this.CreateQuery()
               .Where(o => o.DeleteFlg == 0).ToList();
        }

       


        public MMapCatalogueEntity GetById(int Id)
        {
            return base.CreateQuery().Where(c => c.CatalogueId == Id).ToSingle();
        }
    }
}
